var mysql = require('mysql');
var express = require('express');
var app = express();
var connection = mysql.createConnection({
  host: '127.0.0.1',
  port: '3306',
  user: 'root',
  password: 'admin',
  database: 'db_message'
})
// SELECT english 
// FROM `cet`
// WHERE english IN (SELECT english FROM tb_t)
connection.connect();
var getSql = 'SELECT * FROM tb_message';
var insertSql = ''
var str = '';
var str1 = '';
var str11 = '';
var str22 = '';
var getSql2 = 'SELECT id FROM `tb_msg_word` WHERE english IN (SELECT english FROM cet)'
connection.query(getSql2, function(err, result){
  str11 = JSON.stringify(result);
  console.log(str11);
});
app.get('/', function(req, res) {
  res.setHeader("Access-Control-Allow-Origin", "*");
  res.send(str11);
});

app.listen(8000, function(){
  console.log("Server running at 8000 port");
})